<?php
$this->placeholder("navegacion")->set($this->navegacion($this->nav));
$domConfig = Zend_Registry::get('domConfig');

//Zend_Debug::dump(App_User::getCodigoRol(),"codrol");
//Zend_Debug::dump(App_User::getCodigoInstitucion(),"codins");
//Zend_Debug::dump(App_User::getNombreInstitucion(),"nomins");

//echo App_Util_SafeUrl::encriptar(array("tiposolicitud"=>1),true);
?>
<table width="100%" border="0">
	<tr>
		<td align="center" valign="top" width="40%">
		    <?php if(count($this->datos_reporte)>0): ?>
					<table id="table_id" align="center" class="iceDatTbl" width="95%">
					   <tr>
					   	<th colspan="5">Resumen de Autoevaluación</th>
					   </tr>
					   <tr>
					   	<th colspan="5">
						   <table width="100%">
			               <tr >
			                 <td  width="15%"><div align="center"><strong>APRE</strong></div></td>
			                 <td  width="35%">Acreditaci&oacute;n Pregrado</td>
			                 <td  width="15%"><div align="center"><strong>RPRE</strong></div></td>
			                 <td  width="35%">Renovaci&oacute;n Pregrado</td>
			               </tr>
			               <tr>
			                 <td><div align="center"><strong>APOS</strong></div></td>
			                 <td>Acreditaci&oacute;n Posgrado</td>
			                 <td><div align="center"><strong>RPOS</strong></div></td>
			                 <td>Renovaci&oacute;n Posgrado</td>
			               </tr>
			             </table>
					   </th></tr>
					    <tr>
					      <th width="50%">Estado</th>
					      <th>APRE</th>
					      <th>RPRE</th>
					      <th>APOS</th>
					      <th>RPOS</th>
					    </tr>
					  <tbody>
					  <?php
					      $array_actions = array(1=>"acreditarpregrado",2=>"renovarpregrado",3=>"acreditarposgrado",
					                             4=>"renovarposgrado");

                          $codestado = $this->datos_reporte[0]["codestado"];

					      echo "<tr>";
					   	  echo " <td>{$this->datos_reporte[0]["nombre"]}</td>";
					      $cs = 0;
					      $tp = 1;
					      foreach ($this->datos_reporte as $value){
					         if ($codestado!=$value["codestado"]){
					   		     $td = 4-$cs;
					             echo str_repeat("<td style=\"text-align:center;\">(0)</td>",$td);
					             echo "</tr>";
					             echo "<tr>";
					   	         echo " <td>{$value["nombre"]}</td>";
					   	         $codestado = $value["codestado"];
					   	         $cs=0;
					   	         $tp = 1;
					         }
					  	     $params = App_Util_SafeUrl::encriptar(array("tiposolicitud"=>$value["tiposolicitud"],"codestado"=>$value["codestado"]), true);
                             if ($value["tiposolicitud"]!=$tp){
					  	         while ($value["tiposolicitud"]>$tp){
                                    echo "<td style=\"text-align:center;\">(0)</td>";
                                    $tp++;
                                    $cs++;
							     }
                             }
							 echo "<td style=\"text-align:center;\"><a href=\"".$this->baseUrl("/solicitudes/index/{$array_actions[$value["tiposolicitud"]]}/{$params}")."\">({$value["cantidad"]})</a></td>";
                             $cs++;
                             $tp++;
					      }
			   		     $td = 4-$cs;
			             echo str_repeat("<td style=\"text-align:center;\">(0)</td>",$td);
			             echo "</tr>";
					   ?>
  					  </tbody>
					 </table>
		    <?php else: echo $this->mensajes("No existen registros");?>
            <?php endif;?>
		</td>
		<td align="center" valign="top" width="40%">
		  <div align="left">
<!--				<table align="center" width="95%">-->
<!--			  		<thead><tr><th>&nbsp;</th></tr></thead>-->
<!--		    	</table>-->
		  	</div>
		</td>
		<td align="center" valign="top" width="20%">
		  <div align="left">
		  		<?php
		  		    $params=App_Util_SafeUrl::encriptar(array("codusuario"=>App_User::getCodigoUsuario(),"editarmiperfil"=>true),true);
		  		    if(App_User::getCodigoPadreRol()==Roles_Model_Roles::CODPADRE_PAR || App_User::getCodigoPadreRol()==Roles_Model_Roles::CODPADRE_CONSEJERO){
		  		?>
				<table id="table_id" align="right" class="iceDatTbl zebra">
			  		<thead><tr><th><div align="right"><a href="<?php echo $this->baseUrl("/usuarios/index/ingresarinformacionpar/{$params}");?>">Editar datos personales</a></div></th></tr></thead>
		    	</table>
		    	<?php } else { ?>
				<table id="table_id" align="right" class="iceDatTbl zebra">
			  		<thead><tr><th><div align="right"><a href="<?php echo $this->baseUrl("/usuarios/index/ingresar/{$params}");?>">Editar datos personales</a></div></th></tr></thead>
		    	</table>
		    	<?php } ?>
		    	<br></br>
		    	<?php if ($this->varios_perfiles):?>
				<table id="table_id" align="right" class="iceDatTbl zebra">
			  		<thead><tr><th><div align="right"><a href="<?php echo $this->baseUrl("/usuarios/seguridad/roles");?>">Cambiar de perfil</a></div></th></tr></thead>
		    	</table>
		    	<?php endif;?>
		  </div>
		</td>
	</tr>
</table>
